<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>抄表记录管理</title>
    <!-- DataTables CSS -->
    <link href="https://cdn.datatables.net/1.10.24/css/dataTables.bootstrap4.min.css" rel="stylesheet">
</head>
<body>
    <div class="page-header">
        <h1 class="page-title">抄表录入</h1>
        <button class="btn btn-primary" onclick="openReadingModal()">
            <i class="fas fa-plus"></i> 录入读数
        </button>
    </div>

    <div class="table-container">
        <table id="readingsTable" class="table table-striped table-bordered">
            <thead>
                <tr>
                    <th>抄表记录ID</th>
                    <th>电表号</th>
                    <th>客户信息</th>
                    <th>上次读数</th>
                    <th>本次读数</th>
                    <th>用电量</th>
                    <th>抄表日期</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
                <!-- 数据将通过DataTables动态加载 -->
            </tbody>
        </table>
    </div>

    <!-- 抄表录入模态框 -->
    <div class="modal fade" id="readingModal" tabindex="-1">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title">抄表录入</h5>
                    <button type="button" class="close" data-dismiss="modal">
                        <span>&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <form id="readingForm">
                        <input type="hidden" id="readingId">
                        <div class="form-group">
                            <label>电表号</label>
                            <select class="form-control" id="meterNoSelect" required>
                                <!-- 将通过API动态加载电表列表 -->
                            </select>
                        </div>
                        <div class="form-group">
                            <label>上次读数</label>
                            <input type="number" class="form-control" id="previousReading" required min="0" step="0.01">
                            <small class="form-text text-muted">请输入上次抄表读数</small>
                        </div>
                        <div class="form-group">
                            <label>本次读数</label>
                            <input type="number" class="form-control" id="currentReading" required min="0" step="0.01">
                            <small class="form-text text-muted">请输入本次抄表读数</small>
                        </div>
                        <div class="form-group">
                            <label>抄表日期</label>
                            <input type="date" class="form-control" id="readingDate" required>
                        </div>
                        <div class="form-group">
                            <label>计算结果</label>
                            <div class="card">
                                <div class="card-body">
                                    <p>用电量：<span id="consumption">0</span> 千瓦时</p>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
                    <button type="button" class="btn btn-primary" onclick="saveReading()">保存</button>
                </div>
            </div>
        </div>
    </div>

    <!-- DataTables JS -->
    <script src="https://cdn.datatables.net/1.10.24/js/jquery.dataTables.min.js"></script>
    <script src="https://cdn.datatables.net/1.10.24/js/dataTables.bootstrap4.min.js"></script>
</body>
</html> 